function G=step_game(G)
%
G.is_gameover=0;
PP={};
hh={};
if isempty(G.orders),
    for k=1:G.N;
        PP{k}=G.P{k};
        PP{k}.last_pos=PP{k}.pos;
        PP{k}.last_ang=PP{k}.ang;
        PP{k}.trace=[];
        PP{k}=step_player(G,PP{k},k);
        if size(PP{k}.trace,1)==0,
            PP{k}.trace=[PP{k}.last_pos;PP{k}.pos];
        end;
    end;
    for k=1:G.N;
        G.P{k}=PP{k};
        if PP{k}.is_gameover>0,
            G.is_gameover=k;
            break;
        end;  
        if G.draw>0,
        hh{k}=draw_player(G,PP{k},k);
        h=draw_player_trace(G,PP{k},k);
        end;
    end;
else,
    for k=G.orders;
        PP{k}=G.P{k};
        PP{k}.last_pos=PP{k}.pos;
        PP{k}.last_ang=PP{k}.ang;
        PP{k}.trace=[];
        PP{k}=step_player(G,PP{k},k);
        if size(PP{k}.trace,1)==0,
            PP{k}.trace=[PP{k}.last_pos;PP{k}.pos];
        end;
        G.P{k}=PP{k};
        if PP{k}.is_gameover>0,
            G.is_gameover=k;
            break;
        end;
        if G.draw>0,
        hh{k}=draw_player(G,PP{k},k);
        h=draw_player_trace(G,PP{k},k);
        end;
    end;
end;

hh{G.N+1}=draw_game_trace(G);

G.objs_clear=hh;


